{// 引入标签库 }
<tagLib name="html" />
{// 加载头部公共文件 }
<include file="Public:header" />
<!-- 菜单区域  -->

<!-- 主页面开始 -->
<div id="main" class="main" >

<!-- 主体内容  -->
<div class="content" >
    	<table cellpadding="10px">
		<tr>
			<td valign="top" width="80px" nowrap>
<div class="title">网站栏目</div>
<import file="Js.xtree.xtree" />
<import type="css" file="Js.xtree.xtree" />
<form id="cateform" action="__URL__/cateedit">
	<input type="hidden" name="ajax" value="1" />
<div id="treemenu">
<script language="javascript">
{$genJs}
</script>
</div>
</form>
<div id="treedata">
{$genForm}
</div>
<div class="operate" style="margin:20px;">
	<div id="btn-op1">
<html:imageBtn name="add" value="新增" click="addNode()" style="impBtn fLeft shadow" />
<html:imageBtn name="edit" value="修改" click="editNode()" style="impBtn fLeft shadow" />
<html:imageBtn name="delete" value="删除" click="delNode()" style="impBtn fLeft shadow" />
	</div>
	<div id="btn-op2" class="none">
<html:imageBtn name="delete" value="取消" click="btnToggle(1)" style="impBtn fLeft shadow" />
<input type="hidden" id="btn-optype" value="" />
<html:imageBtn name="save" value="保存" click="saveNode()" style="impBtn fLeft shadow" />
	</div>
<script language="javascript">
function btnToggle(m) {
	if (m==1) {
		p = $('tm-xtree-temp');
		if ($('btn-optype').value) {
			webFXTreeHandler.all[p.parentNode.id].remove();
		}
		else {
			$(p.parentNode.id+'-anchor').style.display='inline';
			p.parentNode.removeChild(p);
		}
		$('btn-optype').value = '';
		$('btn-op1').style.display = 'block';
		$('btn-op2').style.display = 'none';
	}
	else {
		$('btn-op1').style.display = 'none';
		$('btn-op2').style.display = 'block';
	}
}
function addNode() {
	if (tree.getSelected()) {
		btnToggle(0);
		h=tree.getSelected();
		pcid=$('tm-'+h.id).value;
		c=h.add(new WebFXTreeItem('New'));
		$('btn-optype').value = 1;
		$(c.id+'-anchor').style.display='none';
		$(c.id).innerHTML+='<span id="tm-xtree-temp"><input type="text" id="tree-new" name="cname" value="New" /><input type="hidden" name="nodeid" value="'+c.id+'" /><input type="hidden" name="pcid" value="'+pcid+'" /></span>';
		h.expand();
		$('tree-new').select();
	}
}
function editNode() {
	if (tree.getSelected()) {
		btnToggle(0);
		h=tree.getSelected();
		if (h.id=='xtree-2') {return false;}
		$(h.id+'-anchor').style.display='none';
		$(h.id).innerHTML+='<span id="tm-xtree-temp"><input type="text" id="tree-new" name="cname" value="'+h.text+'" /><input type="hidden" name="nodeid" value="'+h.id+'" /><input type="hidden" name="cid" value="'+$('tm-'+h.id).value+'" /></span>';
		$('tree-new').select();
	}
}
function delNode() {
	if (tree.getSelected()) {
		h=tree.getSelected();
		h.remove();
		ThinkAjax.send('__URL__/catedel/ajax/1/cid/'+$('tm-'+h.id).value);
	}
}
function saveNode() {
	ThinkAjax.sendForm('cateform','__URL__/cateedit/',saveNodeHandle);
}
function saveNodeHandle (backid, status) {
	if (status > 0) {
		p = $('tm-xtree-temp');
		id = backid.split(',');
		webFXTreeHandler.all['xtree-'+id[0]].text = $('tree-new').value;
		$('xtree-'+id[0]+'-anchor').innerHTML =  $('tree-new').value;
		if (status == 1) {
			$('treedata').innerHTML += '<input type="hidden" id="tm-xtree-'+id[0]+'" name="cid" value="'+id[1]+'" />';
			$('xtree-'+id[0]+'-anchor').href = "__ACTION__/cid/"+id[1];
	}
		$('xtree-'+id[0]+'-anchor').style.display='inline';
		$('btn-optype').value = '';
		$('btn-op1').style.display = 'block';
		$('btn-op2').style.display = 'none';
		p.parentNode.removeChild(p);
	}
	else {
		window.location.reload();
	}
}
</script>
</div>
			</td>
			<td valign="top">
<div class="title">网站内容列表</div>
<!--  功能操作区域  -->
<div class="operate" >
<html:imageBtn name="add" value="新增" click="add()" style="impBtn hMargin fLeft shadow" />
<html:imageBtn name="edit" value="编辑" click="edit()" style="impBtn hMargin fLeft shadow" />
<html:imageBtn name="delete" value="删除" click="foreverdel()" style="impBtn hMargin fLeft shadow" />
<!-- 查询区域 -->
<div class="fRig">
<form method='post' action="__URL__">
<div class="fLeft"><span id="key"><input type="text" name="name" title="组名" class="medium" ></span></div>
<html:imageBtn type="submit" name="search" value="查询" style="impBtn hMargin fLeft shadow" />
</div>
<!-- 高级查询区域 -->
<div  id="searchM" class=" none search cBoth" >
</div>
</form>
</div>
<!-- 功能操作区域结束 -->

<!-- 列表显示区域  -->
<div class="list" >
<html:list id="checkList" name="user" style="list" checkbox="true" action="true" datasource="list" show="id:编号,title:标题:edit,cid|getModelName=Formcate:栏目,create_time|toDate:发表时间,update_time|toDate:更新时间,status|getStatus:状态" actionlist="status|showStatus=$user['id'],edit:编辑:id" />
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
			</td>
		</tr>
	</table>
<!-- 功能操作区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<!-- 主页面结束 -->

